package com.qf.agro.service.sys.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.agro.common.sys.SysUserHolder;
import com.qf.agro.mapper.sys.SysLogMapper;
import com.qf.agro.pojo.sys.SysLog;
import com.qf.agro.service.sys.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 王威
* @description 针对表【sa_sys_log】的数据库操作Service实现
* @createDate 2023-06-30 19:10:01
*/
@Service
public class SysLogServiceImpl implements SysLogService {
    
    @Autowired
    private SysLogMapper sysLogMapper;

    @Override
    public Page<SysLog> findPage(Integer pageNum, Integer pageSize, String name) {
        //1.创建分页page对象
        Page<SysLog> page = new Page<>(pageNum,pageSize);
        //2.创建查询条件对象
        LambdaQueryWrapper<SysLog> queryWrapper = new LambdaQueryWrapper<>();
        //3.设置查询条件
        queryWrapper.eq(SysLog::getCompanyId, SysUserHolder.get().getCompanyId());
        //4.分页查询
        page = sysLogMapper.selectPage(page,queryWrapper);
        //5.返回
        return page;
    }

    @Override
    public void save(SysLog sysLog) {
        sysLogMapper.insert(sysLog);
    }



    @Override
    public Integer disabled(Long id) {
       return null;
    }

    @Override
    public void update(SysLog sysLog) {

        sysLogMapper.updateById(sysLog);
    }
}




